package com.saumya.robotlegs.view
{
	import com.saumya.robotlegs.events.ApplicationStartEvent;
	import com.saumya.robotlegs.events.JSFLCreationEvent;
	
	import flash.events.MouseEvent;
	
	import org.robotlegs.mvcs.Mediator;

	public class SaumyaPublishUIMediator extends Mediator
	{
		[Inject]
		public var view:SaumyaPublishUI;
		
		private var introView:IntroView;
		private var logger:LoggerView;
		private var baseView:BaseUI;
		
		public function SaumyaPublishUIMediator()
		{
			//Do Nothing
		}
		
		public override function onRegister():void
		{
			//this.view.logger.text=String('Mediator : Main view is on stage now.'+'\n');
			//Adds the views
			this.introView=new IntroView();
			this.view.addElement(this.introView);
			//listen to view
			
			//lisen to context
			this.eventMap.mapListener(this.eventDispatcher,ApplicationStartEvent.BEGIN,onApplicationBegin);
		}
		
		//event handlers
		private function onApplicationBegin(e:ApplicationStartEvent):void
		{
			//this.view.logger.text="Application is to Begin!";//Debugging only
			//Hides the initial view
			this.introView.visible=false;
			//adds the logger
			this.logger=new LoggerView();
			this.view.addElement(this.logger);
			//adds the base view
			this.baseView=new BaseUI();
			this.baseView.configPanel.visible=false;
			this.baseView.publishPanel.visible=false;
			this.view.addElement(this.baseView);
		}
		
	}
}